import {_decorator, Component, RichText, Label, Button, Node} from 'cc';
const { ccclass, property } = _decorator;

@ccclass('TipsFramePrefUI')
export class TipsFramePrefUI extends Component {

    @property(Label)
    titleLabel: Label = null;
    @property(RichText)
    contextLabel: RichText = null;
    @property(Button)
    okBtn: Button = null;
    // 回调函数
    callback: Function = null;

    public setTitle(title: string): void {
        if (this.titleLabel) {
            this.titleLabel.string = title;
        }
    }

    public setContext(context: string): void {
        if (this.contextLabel) {
            this.contextLabel.string = context;
        }
    }

    public setBtnCallback(callback: Function): void {
        this.callback = callback;
    }

    private onClickOkBtn(): void {
        this.callback();
        this.node.destroy();
    }

}


